package qdu.edu.com.fushanf4.service.count;

import org.apache.hadoop.mapreduce.Job;
import qdu.edu.com.fushanf4.utils.ConfigurationUtil;
import qdu.edu.com.fushanf4.utils.DriverUtil;

import java.io.IOException;

/**
 * 该类用来统计content_lag_dataset.txt文件中用户类型出现的频率
 */
public class UserTypeFrequencyDriver extends DriverUtil {
    public static void main(String[] args) throws IOException {
        UserTypeFrequencyDriver userTypeFrequencyDriver = new UserTypeFrequencyDriver();
        userTypeFrequencyDriver.run(args);
    }

    @Override
    public Job runJob(String[] path) throws IOException {
        Job job = ConfigurationUtil.getJob();

        // 设置Jar路径加载
        job.setJarByClass(UserTypeFrequencyDriver.class);

        // 设置Map和Reduce类
        job.setMapperClass(UserTypeFrequencyMapper.class);

        TextIntWritableCountReducer.setReduceOfAll(job);

        assert ConfigurationUtil.setPathAndRunJob(path, job);
        return job;
    }
}
